package com.zhangshuo.patternDesign.adapter;

import java.util.Observable;
import java.util.Observer;

/**
 * Created by shuo.zhang on 2017-10-23.
 *
 *
 * 这是一个基础的用户实体，如果想要被观察的功能，按以下内容去做
 *使用内部组装的方式，但是有一个缺点，如果私有的类中有非public的方法时，无法体现出来...............
 *
 *
 *
 *
 */
public class UserEntity extends BaseEntity {

    private Integer id ;
    private String userName;
    private String password;
    private Observable observable = new Observable();


    public synchronized void addObserver(Observer o) {
        observable.addObserver(o);
    }

    public synchronized void deleteObserver(Observer o){
        observable.deleteObserver(o);
    }

    public void notifyObservers(Object arg){
        observable.notifyObservers(arg);
    }



    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }
}
